package com.study.demo1;

/**
 * 婚庆公司对婚礼进行增强(代理对象)
 */
public class WeddingCompany implements Marry {

    //目标对象You(多态)
    private Marry target;

    public WeddingCompany(Marry target) {
        this.target = target;
    }

    @Override
    public void toMarry() {

        //前置增强
        before();
        //执行目标方法
        target.toMarry();
        //后置增强
        after();
    }

    private void after() {
        System.out.println("婚礼完成，送上祝福");
    }

    private void before() {
        System.out.println("安排婚礼场地");
    }
}
